package cn.xiaobai.domain;

import cn.xioabai.common.domain.ResultDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 日期处理结果
 *
 * @Author yangdaji
 * @Date 2023/8/14
 * @PackageName cn.xiaobai.domain
 * @ClassName Days
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DayResult implements Serializable {

    private String date;

    private Result result;


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    static class Result {
        private String msg;
        private Integer state;
    }

    public DayResult(String date) {
        this.date = date;
    }

    public DayResult convert(ResultDTO resultDTO) {
        Result data = new Result(resultDTO.getMsg(), (Integer) resultDTO.getData());
        setResult(data);
        return this;
    }
}
